#include "Color.h"

/*********************************************/
void Color::setRGBComponents(const uint8& red, const uint8& green, const uint8& blue)
{
	r = red;
	b = blue;
	g = green;
}
/*********************************************/
void Color::getRGBComponents(uint8& red, uint8& green, uint8& blue) const
{
	red = r;
	blue = b;
	green = g;
}
/*********************************************/
void Color::setGreyScale(const uint8& val)
{
	r = val;
	g = val;
	b = val;
}
/*********************************************/
bool Color::operator==(const Color& col) const
{
	if (( r == col.r ) && ( g == col.g ) && ( b == col.b )) return true;
	else return false;
}
/*********************************************/
Color Color::operator+(const Color& col) const
{
	Color		newC;

	newC.r = r + col.r;
	newC.g = g + col.g;
	newC.b = b + col.b;
	
	return( newC );
}
/*********************************************/
Color Color::operator*(const fl64& scale) const
{
	Color		newC;
	
	newC.r = r*scale;
	newC.g = g*scale;
	newC.b = b*scale;

	return( newC );
}
/*********************************************/
uint8& Color::operator[](const char& comp) 
{
	switch( comp ) {
		case ('r'): return( r );
		case ('g'): return( g );
		case ('b'): return( b );
	}
}
/*********************************************/
Color::Color( const Color& c )
{
	r = c.r;
	g = c.g;
	b = c.b;
}
/*********************************************/
Color::Color()
{
	r = 0;
	g = 0;
	b = 0;
}
/*********************************************/
Color::Color(const uint8 r_, const uint8 g_, const uint8 b_)
{
	r = r_;
	g = g_;
	b = b_;
}
/*********************************************/
std::ostream& operator<<(std::ostream& ostr, const Color& c)
{
	ostr << "Color: " << int(c.r) << " | " << int(c.g) << " | " << int(c.b) << std::endl;
}